package com.test.controller;


import com.test.entity.CompAllInfoDto;
import com.test.entity.TeaAllInfoDto;
import com.test.service.EchartInfoService;
import com.test.service.ManagerOperatService;
import org.omg.CORBA.Object;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/echarts")
public class EchartsInfoController extends BaseController{

    @Autowired
    private EchartInfoService echartInfoService;

    @RequestMapping("/selectAllCompCount")
    @ResponseBody
    public String  selectAllCompCount(){
             int compCount  = echartInfoService.selectAllCompCount();
             if(compCount>0){
                 return compCount+"家"+"";
             }else{
                 return "0家";
             }
    }


    @RequestMapping("/selectPieChart")
    @ResponseBody
    public List<Map<Object,Object>> selectPieChart(){
        List<Map<Object,Object>> pieChart = echartInfoService.selectPieChart();
            return pieChart;
    }


    //查询所有公司的地址
    @RequestMapping("/selectCompMap")
    @ResponseBody
    public List<String> selectCompMap(){
        List<String> compMapListStr = echartInfoService.selectCompMap();
        return compMapListStr;
    }



    //查询所有种类的数量
    @RequestMapping("/selectkindCount")
    @ResponseBody
    public List<Map<String, java.lang.Object>>  selectkindCount(){
        List<Map<String, java.lang.Object>>  compMapListStr = echartInfoService.selectkindCount();
        return compMapListStr;
    }



    //查询所有公司的种类数量
    @RequestMapping("/selectBarCompNum")
    @ResponseBody
    public List<Map<String, java.lang.Object>>  selectBarCompNum(){
        List<Map<String, java.lang.Object>>  compMapListStr = echartInfoService.selectBarCompNum();
        return compMapListStr;
    }


    //查询所有公司的种类数量
    @RequestMapping("/selectStuAttentKindPieChart")
    @ResponseBody
    public List<Map<java.lang.Object, java.lang.Object>>  selectStuAttentKindPieChart(HttpSession session){
        String u_acount =  session.getAttribute("stu_u_acount").toString();
        List<Map<java.lang.Object, java.lang.Object>>  compMapListStr = echartInfoService.selectStuAttentKindPieChart(u_acount);
        return compMapListStr;
    }


}
